<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Remove a file and its chunks from the database</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongogridfs.construct.html">« MongoGridFS::__construct</a></li>
      <li style="float: right;"><a href="mongogridfs.drop.html">MongoGridFS::drop »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongogridfs.html">MongoGridFS</a></li>
    <li>Remove a file and its chunks from the database</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongogridfs.delete" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoGridFS::delete</h1>
  <p class="verinfo">(PECL mongo &gt;=1.0.8)</p><p class="refpurpose"><span class="refname">MongoGridFS::delete</span> &mdash; <span class="dc-title">Remove a file and its chunks from the database</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongogridfs.delete-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoGridFS::delete</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$id</code></span>): <span class="type"><span class="type">bool</span>|<span class="type">array</span></span></div>


  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="methodname"><strong>MongoGridFS::delete()</strong></span> is a convenience method for
    calling <span class="methodname"><a href="mongogridfs.remove.html" class="methodname">MongoGridFS::remove()</a></span> with specific
    <code class="parameter">criteria</code> and default <code class="parameter">options</code>
    parameters.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongogridfs.delete-parameters">
 <h3 class="title">Parameters</h3>
 <p class="para">
  <dl>

   
    <dt>

     <code class="parameter">id</code>
    </dt>

    <dd>

     <p class="para">
      <code class="literal">_id</code> of the file to remove.
     </p>
    </dd>

      
  </dl>

 </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongogridfs.delete-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array containing the status of the removal (with respect to the
   <code class="literal">files</code> collection) if a
   <a href="mongo.writeconcerns.html" class="link">write concern</a> is applied.
   Otherwise, returns <strong><code>true</code></strong>.
  </p>
  <p class="para">
   Fields in the status array are described in the documentation for
   <span class="function"><a href="mongocollection.insert.html" class="function">MongoCollection::insert()</a></span>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongogridfs.delete-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">Throws <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> if the <code class="literal">&quot;w&quot;</code> option is set and the write fails.</p><p class="para">Throws <a href="class.mongocursortimeoutexception.html" class="classname">MongoCursorTimeoutException</a> if the <code class="literal">&quot;w&quot;</code> option is set to a value greater than one and the operation takes longer than <var class="varname">MongoCursor::$timeout</var> milliseconds to complete.  This does not kill the operation on the server, it is a client-side timeout. The operation in <var class="varname">MongoCollection::$wtimeout</var> is milliseconds.</p>
 </div>


</div></div></div></body></html>